<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

<script>
function createCounter() {
    let count = 0;
    //要求：
    //使用闭包实现一个简单的计数器，每次调用时返回当前的计数值。

    return function() {
        count += 1;
        return count;
    };
}

const counter = createCounter(); 

console.log(counter());
console.log(counter());
console.log(counter());
</script>
</body>
</html>